package utils;

import java.util.Observable;

import commands.Commands;

import nanoxml.XMLElement;

/**
 * A user in the system.
 */
public class User extends Observable implements ITransmittable {
	
	private final static String ATT_USERNAME = "Username";
	
	private String username;

	
	public User (String username) {
		this.username = username;
	}
	
	public User (XMLElement message) {
		this.username = message.getStringAttribute(ATT_USERNAME);
	}
	
	
	public String getUsername() {
		return username;
	}
	
	public XMLElement toXML() {
		XMLElement message = new XMLElement ();
		message.setName(Commands.USER);
		message.setAttribute (ATT_USERNAME, username);
		return message;
	}
}